<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <script>
        var doc = document,
            docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            recalc = function() {
                var clientWidth = docEl.clientWidth;
                if (!clientWidth) return;
                docEl.style.fontSize = 12 * (clientWidth / 320) + 'px';
            };
        if (!!doc.addEventListener) {
            window.addEventListener(resizeEvt, recalc, false);
            doc.addEventListener('DOMContentLoaded', recalc, false);
        }
    </script>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="format-detection" content="telephone=no">
    <title>健康处方</title>
    <link rel="Shortcut Icon" href="images/logo.gif">
    <link rel="stylesheet" href="libs/reset.css">
    <style>
    html,
    body {
        box-sizing: border-box;
        width: 100%;
        height: 100%;
    }
    body{
        color: #333;
    }

    .list li {
        position: relative;
        box-sizing: border-box;
        padding: 1rem .8rem .4rem;
        background: linear-gradient(0deg, #e4e4e4 50%, transparent 50%) no-repeat 0 bottom;
        background-size: 100% 1px;
    }
    .list li:active{
        background-color: #eee
    }
    .list img{
        /*width: 6rem;*/
        width: 25%;
        height: 4.8rem;
    }
    .list-info{
        display: -webkit-flex;
        display: flex;
        /*margin-left: 1rem;*/
        overflow: hidden;
    }
    .list-info>div{
        width: 75%;
        /*flex-grow: 1;*/
        box-sizing: border-box;
        padding-left: 0.533333rem;
    }
    .list-info h4{
        line-height: 1.6;
        font-size: 1.3rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .list-info p{
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #666;
    }
    .pulish-time{
        color: #999;
        font-size: 12px;
        text-align: right;
        line-height: 2
    }
    .article-container{
        position: fixed;
        left: 100%;
        top: 0;
        z-index: 9999;
        box-sizing: border-box;
        width: 100%;
        height: 100%;
        padding: 1.0rem;
        background-color: #fff;
        transform: translate3d(100%,0,0);
        overflow: auto;
    }
    .article-container h1{
        font-size: 1.333333rem;
        font-weight: bold;
    }
    .article-container .time{
        margin: 0.833333rem 0;
        color: #999;
    }
    .article-container .line{
        height: 0.833333rem;
        margin-bottom: 1.6rem;
        background-size: contain;
    }
    .line0{
        background: url('images/line0.png');
    }
    .line1{
        background: url('images/line1.png');
    }
    .article-container img{
        max-width: 60%;
    }
    .article{
        line-height: 2;
        text-indent: 2em;
        letter-spacing: .2em;
    }
    .rightin{
        -webkit-animation: rightin .3s forwards;
        animation: rightin .3s forwards;
    }
    .rightout{
        -webkit-animation: rightout .3s forwards;
        animation: rightout .3s forwards;
    }
    @keyframes rightin {
        0%{
            -webkit-transform: translateX(0);
            transform: translateX(0);
        }
        100%{
            -webkit-transform: translateX(-100%);
            transform: translateX(-100%);
        }
    }

    @-webkit-keyframes rightin {
        0%{
            -webkit-transform: translateX(0);
            transform: translateX(0);
        }
        100%{
            -webkit-transform: translateX(-100%);
            transform: translateX(-100%);
        }
    }

    @keyframes rightout {
        0%{
            -webkit-transform: translateX(-100%);
            transform: translateX(-100%);
        }
        100%{
            -webkit-transform: translateX(0);
            transform: translateX(0);
        }
    }

    @-webkit-keyframes rightout {
        0%{
            -webkit-transform: translateX(-100%);
            transform: translateX(-100%);
        }
        100%{
            -webkit-transform: translateX(0);
            transform: translateX(0);
        }
    }
    </style>
</head>

<body>
    <ul class="list">
        <li>
            <div class="list-info">
                <img src="images/wx-1.jpg">
                <div>
                    <h4>文章标题短</h4>
                    <p>内容短</p>
                </div>
            </div>
            <div class="pulish-time">2018-02-20</div>
        </li>
        <li>
            <div class="list-info">
                <img src="images/wx-1.jpg">
                <div>
                    <h4>文章标题长文章标题长文章标题长文章标题长文章标题长</h4>
                    <p>内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长内容长</p>
                </div>
            </div>
            <div class="pulish-time">2018-02-20</div>
        </li>
    </ul>

    <!-- 文章预览 -->
    <div class="article-container" style="background-color: red">
        <h1>二甲双胍：让你也可以活到120岁的“长生药”</h1>
        <div class="time">发布时间：2017-09-10 10:01:12</div>
        <div class="line"></div>
        <p class="article">文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述文章描述</p>
    </div>
    <script src="./libs/zepto.min.js"></script>
    <script src="libs/fastclick.js"></script>
    <script>
    $(function() {
        FastClick.attach(document.body);

        var style = (document.body||document.documentElement).style;
        var animationEnd = (function() {
            var animEndEventNames = {
                WebkitAnimation: 'webkitAnimationEnd',
                animation: 'animationend'
            }
            for (var name in animEndEventNames) {
                if (typeof style[name] === "string") {
                    return animEndEventNames[name]
                }
            }
        })();

        // 跳转
        var _className;
        var $article = $('.article-container');
        $('.list').on('click', 'li', function() {
            _className = 'line'+parseInt(Math.random()*10)%2;
            $('.line').addClass(_className);//切换分界线背景

            $article.removeClass('rightout').addClass('rightin');
            window.history.pushState(null,'','');
        });

        window.addEventListener('popstate',function(){
            $article.removeClass('rightin').addClass('rightout');
            $('.line').removeClass(_className);
        },false);
    })
    </script>
</body>

</html>
